<template>
  <div id="exchangeorder">  

    <el-form ref="form" :model="form" label-width="80px">  
     <el-row> 

        <el-col :span="18" style="display:flex;">

            <!-- <el-form-item label="" label-width="0px">
                <el-select  v-model="form.select_num" placeholder="请选择状态" style="width:160px;">
                    <el-option  v-for="(item,index) in select_data" :key="index" :label="item.name" :value="item.id"></el-option>
                </el-select>
            </el-form-item> -->

           <el-form-item label="" label-width="0px"  >
                 <el-date-picker type="date" :clearable='false' @change="data_change" placeholder="选择日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd"  v-model="form.time" style="width:160px;"></el-date-picker>
            </el-form-item>

            <el-form-item label="" label-width="0px" style="margin-left:10px;">
                <el-select  v-model="form.select_num_zy" placeholder="请选择蜂巢" style="width:160px;">
                    <el-option  v-for="(item,index) in select_data_zy" :key="index" :label="item.title" :value="item.maid"></el-option>
                </el-select>
            </el-form-item>

            <el-form-item label-width="0px" style="margin-left:10px;">
               <el-input v-model="form.bh" :placeholder="variable_name4 + '编号'" style="width:160px;"></el-input>
            </el-form-item>
            
             <el-form-item label="" label-width="0px" style="margin-left:10px;">
                <el-select  v-model="form.select_num_mode" placeholder="请选择方式"  style="width:160px;">
                    <el-option  v-for="(item,index) in select_data_mode" :key="index" :label="item.name" :value="item.id"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label-width="0px" style="margin-left:10px;">
               <el-input v-model="form.phone" placeholder="账户" style="width:160px;"></el-input>
            </el-form-item>


           <div class="custom_button2"  style="margin-left:10px;" @click="search_but"></div>
        </el-col>

        <el-col :span="6" style="text-align: right;">  
            <el-button type="primary" class="custom_color_button" style="margin-bottom:10px;" @click="refresh_but()">刷新</el-button>            
        </el-col>
    
    </el-row> 
   
   </el-form>
   <!-- 渲染数据list -->
   <exchangeorder-list1 :datalist="datalist" @up_list_fun="list_fun"> </exchangeorder-list1>

      
   <div style="margin-top:20px;text-align: center;">
      <el-pagination
        background
        @current-change="handleCurrentChange"
        :page-size="10"  
        layout="prev, pager, next, jumper"
        :total="count">
      </el-pagination>
    </div>

      
  </div>
</template>

<script>


import ExchangeorderList1 from '@/view/Aftersale/Orderinquiry/ExchangeorderList1'
export default {
  name: 'exchangeorder',
  data () {
    return {
        datalist:[],
        page:1,
        count:0,
        form:{
          time:'',
          phone:'',
          bh:'',
          select_num:'',
          select_num_zy:'',
          select_num_mode:0
        },
        select_data_zy:[],
        select_data:[{"id":"cancel_no_submit","name":"未上传凭证取消"},{"id":"cancel_no_finished","name":"未完成订单取消"},{"id":"wait_submit","name":"未上传凭证"},
          {"id":"submitted_first","name":"待确认/上传凭证"},{"id":"reject","name":"已驳回"},{"id":"submitted_second","name":"新上传"},{"id":"seller_appeal","name":"出让方申述"},
          {"id":"buyer_appeal","name":"兑换方申述"},{"id":"finish","name":"已完成"},{"id":"overtime","name":"超时自动完成"},{"id":"wait_admin","name":"申述待判定"},
          {"id":"seller_reason","name":"出兑方责任"},{"id":"buyer_reason","name":"兑换方责任"},{"id":"seller_mistake","name":"出让方确认申述"}
          ,{"id":"buyer_mistake","name":"兑换方确认申述"}],
        select_data_mode:[{"id":0,"name":"全部"},{"id":1,"name":"出兑方"},{"id":2,"name":"兑换方"}],
    }
  },
 components:{
    ExchangeorderList1
  },
  created(){
    //  this.form.time = this.getNowDate1()
     //this.list_fun()
     this.list_zy()
  },
  mounted (){
    
  },
  methods: {
       list_zy(){
        this.post("/manor/manorOption", {
        }).then(res => { 
            this.select_data_zy = res.result     
            //console.log(this.select_data_zy)                  
        })
      },
      list_fun(){
          this.post("/trade_goods/listOfData", {
              page:this.page,
              pid:this.form.bh,
              onetime:this.form.time,
              telphone:this.form.phone,
              type:this.form.select_num,
              maid:this.form.select_num_zy,
              buyOrSale:this.form.select_num_mode,
              search_all:0, //0 分页 1 全部
              novice:1,
              member_type:1
	        }).then(res => {
            this.count = res.result.count
            this.datalist = res.result.list

              for(let item of this.datalist) {

                 item.voucher_linkList = [this.urlimg + item.voucher_link]  //首次上传凭证图片
                item.again_voucher_linkList = [this.urlimg + item.again_voucher_link]  //重新上传凭证图片
                 item.reason_picturelist =  [this.urlimg + item.reason_picture]  //驳回图片

                item.appeal_picturelist =  [this.urlimg + item.appeal_picture]  //申述图片
              }

            console.log(res)
         })
      },
      search_but(){

        if(this.form.time !='' || this.form.phone !='' || this.form.select_num != '' || this.form.bh != '' || this.form.select_num_zy != ''){
             this.page = 1
             this.list_fun()
        }

      },

      refresh_but(){
        this.page = 1
        this.form={
          time:'',
          phone:'',
          bh:'',
          select_num:'',
          select_num_zy:'',
          select_num_mode:0
        }
        //this.list_fun()
        this.datalist = []
      },
       data_change(){
        console.log(this.form.time)
      },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        this.page = val
        this.list_fun()
        console.log(`当前页: ${val}`);
      }
  }
}
</script>


<style scoped>
</style>
